<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <h3>父级数据：</h3>
        <p>姓名：{{name}} 年龄：{{age}}</p>
        <my-component :age="age" :name="name"></my-component>
    </div>
    <template id="temp">
        <div>
            <h3>传到子组件的数据:</h3>
            组件姓名：{{myname}},年龄：{{myage}},爱好：{{love}}。
        </div>
    </template>
    <script type="text/javaScript" charset="UTF-8" src="/JS文件/vue.js"></script>
    <script>
        Vue.component('my-component',{
            props:{
                age:Number,
                name:String,
                love:{
                    type:String,
                    default:'red book'
                }
            },
            template:'#temp',
            data(){
                return {
                    myname:this.name+"小朋友",
                    myage:this.age-35
                }
            }
        })
        var vm = new Vue({
            el:'#app',
            data:{
               msg:'hello world',
               age:48,
               name:'李四',
            }
        });
    </script>
</body>
</html>